package com.atguigu.gulimall.ware.myException;

import com.atguigu.common.exception.BizCodeEnum;
import com.atguigu.common.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GulimallWareExceptionControllerAdvice {

    @ExceptionHandler(value = MergeException.class)
    public R handleMergeException(MergeException e){
        return R.error(BizCodeEnum.MERGE_EXCEPTION.getCode(),BizCodeEnum.MERGE_EXCEPTION.getMsg()).put("data",e.getMessage());
    }
}
